/*
 * TCSS 558
 * Distributed HashMap
 * Fall 2013
 * James Marquardt
 * Matt Adams
 * Justin Wong
 */
package model;
import static com.google.common.base.Preconditions.*;

import java.io.Serializable;

import node.RemoteNode;

/**
 * RemoteNodeData is used as a dedicated object for RMI communication.
 * 
 * @author Matt Adams
 */
public final class RemoteNodeData implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = -8776180667992564442L;

    /**
     * The reference to the remote node represented by this. 
     */
    protected RemoteNode remoteNode; 
    
    /**
     * The ID of the remote node represented by this. 
     */
    protected int nodeID; 
    
    /**
     * The HostPort of the remote node represented by this. 
     */
    protected HostPort nodeHostPort;
    
    /**
     * Constructs RemoteNodeData object.
     * 
     * @param remoteNode The reference to the remote node represented by this.
     * @param nodeID The ID of the remote node represented by this.
     * @param nodeHostPort The HostPort of the remote node represented by this.
     */
    public RemoteNodeData(RemoteNode remoteNode, int nodeID, HostPort nodeHostPort) {
        checkArgument(nodeID >= 0, "Node ID must be greater than zero.");
        this.remoteNode = checkNotNull(remoteNode, "Reference to remote node cannot be null.");
        this.nodeID = nodeID;
        this.nodeHostPort = checkNotNull(nodeHostPort, "Node HostPort cannot be null."); 
    }

    /**
     * @return Reference to the remote node represented by this.
     */
    public RemoteNode getRemoteNode() {
        return remoteNode;
    }

    /**
     * @return Host and port of the remote node represented by this.
     */
    public HostPort getHostPort() {
        return this.nodeHostPort;
    }

    /**
     * @return ID of the remote node represented by this.
     */
    public int getNodeID() {
        return this.nodeID;
    } 

}
